package com.android.lovely.room

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import kotlinx.coroutines.flow.Flow

@Dao
interface ProfileDao {

    @Query("select * from Profile where cache_id=:id")
    suspend fun queryProfile(id: String): CacheProfile?

    @Query("select count(id) from Profile where cache_id=:id")
    fun hasProfile(id: String): Int

    @Query("select * from Profile where cache_id=:id")
    fun queryProfileFlow(id: String): Flow<CacheProfile?>

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insert(profile: CacheProfile)
}